package com.muyu.vehicle.service.impl;

import java.util.List;
import com.vehicle.common.core.utils.DateUtils;
import com.vehicle.common.core.utils.IdUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.muyu.vehicle.mapper.VehicleFaultInfoMapper;
import com.muyu.vehicle.domain.VehicleFaultInfo;
import com.muyu.vehicle.service.IVehicleFaultInfoService;

/**
 * 车辆故障码Service业务层处理
 *
 * @author muyu
 * @date 2021-09-04
 */
@Service
public class VehicleFaultInfoServiceImpl implements IVehicleFaultInfoService
{
    @Autowired
    private VehicleFaultInfoMapper vehicleFaultInfoMapper;

    /**
     * 查询车辆故障码
     *
     * @param id 车辆故障码主键
     * @return 车辆故障码
     */
    @Override
    public VehicleFaultInfo selectVehicleFaultInfoById(String id)
    {
        return vehicleFaultInfoMapper.selectVehicleFaultInfoById(id);
    }

    /**
     * 查询车辆故障码列表
     *
     * @param vehicleFaultInfo 车辆故障码
     * @return 车辆故障码
     */
    @Override
    public List<VehicleFaultInfo> selectVehicleFaultInfoList(VehicleFaultInfo vehicleFaultInfo)
    {
        return vehicleFaultInfoMapper.selectVehicleFaultInfoList(vehicleFaultInfo);
    }

    /**
     * 新增车辆故障码
     *
     * @param vehicleFaultInfo 车辆故障码
     * @return 结果
     */
    @Override
    public int insertVehicleFaultInfo(VehicleFaultInfo vehicleFaultInfo)
    {
        vehicleFaultInfo.setCreateTime(DateUtils.getNowDate());
        vehicleFaultInfo.setId(IdUtils.fastSimpleUUID());
        return vehicleFaultInfoMapper.insertVehicleFaultInfo(vehicleFaultInfo);
    }

    /**
     * 修改车辆故障码
     *
     * @param vehicleFaultInfo 车辆故障码
     * @return 结果
     */
    @Override
    public int updateVehicleFaultInfo(VehicleFaultInfo vehicleFaultInfo)
    {
        vehicleFaultInfo.setUpdateTime(DateUtils.getNowDate());
        return vehicleFaultInfoMapper.updateVehicleFaultInfo(vehicleFaultInfo);
    }

    /**
     * 批量删除车辆故障码
     *
     * @param ids 需要删除的车辆故障码主键
     * @return 结果
     */
    @Override
    public int deleteVehicleFaultInfoByIds(String[] ids)
    {
        return vehicleFaultInfoMapper.deleteVehicleFaultInfoByIds(ids);
    }

    /**
     * 删除车辆故障码信息
     *
     * @param id 车辆故障码主键
     * @return 结果
     */
    @Override
    public int deleteVehicleFaultInfoById(String id)
    {
        return vehicleFaultInfoMapper.deleteVehicleFaultInfoById(id);
    }
}
